<!DOCTYPE html>
<html>
<meta charset="utf-8"> 
<head>
	<title data-localize="statistics_print2.printanalysistwo">印刷机分析二</title>
<link rel="stylesheet" type="text/css" href="css/common.css">
<style type="text/css">
.u-container{
	position: relative;
	width: 100%;
	height: 140px;
	margin: 0 auto;
	margin-top: 40px;
	overflow-x: hidden;
	overflow-y: auto;
}
.u-container .machine:hover{
	background: #29abe2;
}
.u-container p{
	display: none;
}
.machine{
	float: left;
	height: 130px;
	text-align: center;
}
.machine img{
	height: 100%;
}
.undone{
	-webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */
    filter: grayscale(100%);
    background: #d0d0d0;
}
.u-datacon{
	position: relative;
	width: 100%;
	height: 840px;
}
.u-leftline{
	position: relative;
	width: 50%;
	height: 540px;
	float: left;
}
.u-chartcon{
	position: relative;
	float: left;
	width: 900px;
	height: 900px;
	margin-top: 40px;
	margin-left: 100px;
	text-align: center;
	overflow: hidden;
}
.u-chart{
	position: relative;
	float: left;
	width: 100%;
	height: 300px;
	margin: 172px 0 0 26px;
	border-left: 1px solid #aaa;
	border-bottom: 1px solid #aaa;
}
.u-chartleft{
	position: absolute;
	display: block;
	height: 100%;
	width: 20px;
	left: -22px;
	top: 0;
}
.u-changetime{
	width: 100%;
	height: 30px;
}
.u-changetime input.datainp{
	text-indent: 7px;
	height: 27px;
	width: 170px;
	-webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
	border: 1px solid #d0d0d0;
	margin-left: 4px;
}
.u-start{
	float: left;
	margin-left: 90px;
}
.u-start label,.u-end label{
	display: inline-block;
	text-align: left;
	width: 100px;
}
.u-end{
	float: left;
	margin-left: 10px;
}
.u-auto{
	line-height: 27px;
}
.u-chartbottom{
	position: absolute;
	display: block;
	width: 40px;
	height: 20px;
	line-height: 20px;
	margin: 0;
	left: -30px;
	bottom: -22px;
}
.u-chartbars{
	float: left;
	position: relative;
	height: 100%;
	width: 20px;
	margin-left: 20px;
	-webkit-transform: rotateX(180deg);
}
.u-chartbars .u-mname{
	position: absolute;
	left: -15px;
	top: -16px;
	line-height: 16px;
	width: 50px;
	font-size: 12px;
	-webkit-transform: rotateX(-180deg);
}
.u-product{
	float: left;
	height: 46px;
	width: 100%;
	bottom: 0;
	left: 0;
	background: #f5d73e;
}
.u-break{
	float: left;
	width: 100%;
	height: 20px;
	background: #f44336;
}
.u-error{
	float: left;
	width: 100%;
	height: 20px;
	background: #009fff;
}
.u-chartbars:nth-child(1) .u-product{
	height: 70%;
}
.u-chartbars:nth-child(2) .u-product{
	height: 20%;
}
.u-chartbars:nth-child(3) .u-product{
	height: 50%;
}
.u-chartbars:nth-child(4) .u-product{
	height: 90%;
}
.u-chartbars:nth-child(5) .u-product{
	height: 40%;
}
.u-xm{
	width: 100%;
	margin-top: 20px;
	text-align: left;
}
.u-xm label{
	width: 100px;
	display: inline-block;
}
.u-xm select{
	width: 170px;
	height: 30px;
	-webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
	border: 1px solid #d0d0d0;
}
.loading{
	background-color: rgba(255,255,255,0.9);
	background-position: center center;
	width: 100%;
	height: 100%;
	background-image: url("image/loading.gif");
	position: absolute;
	left: 0;
	top: 0;
	z-index: 10000;
	background-repeat: no-repeat;
}
.selectTitle{
	display: block;
	margin-bottom: 10px;
	text-align: left;
	margin-left: 50px;
	background: #f4f4f4;
	padding: 10px;
	padding-left: 50px;
	border-radius: 5px;
}
.selectTitle select{
	border: 1px solid #d0d0d0;
	border-radius: 5px;
	height: 30px;
	margin-left: 60px;
	width: 170px;

}
</style>
<link rel="stylesheet" type="text/css" href="css/machine.css">
	<link rel="stylesheet" type="text/css" href="js/jedate/jedate.css">
</head>
<body>
<div class="loading"></div>
<div class='u-head'>
   <div class="u-headcon">
	<a href="index.html"><div class="u-mainpage" data-localize="statistics_print2.backindex">回到首页</div></a>
	<h3 data-localize="statistics_print2.printanalysis">印刷机分析</h3>
	   <div class="changeLang">
		   <p class="u-lang"><span>中文</span><span>English</span></p>
		   <div isopen="true" class="changeLangBtn"></div>
	   </div>
</div>
</div>

<div class="u-datacon">
	<div class="u-chartcon">
		<div class="selectTitle">
			<label data-localize="statistics_print2.item">项目</label>
			<select class="selectType" onchange="sel_type()">
				<option value ="2" data-localize="statistics_print2.hour">按小时</option>
				<option value ="3" data-localize="statistics_print2.minute">按分</option>
				<option value ="1" data-localize="statistics_print2.piece">按片</option>
			</select>
		</div>
		<div class="u-changetime part-changetime" hidden>
			<div class="u-start"><label data-localize="statistics_print2.begintime">开始时间</label><input type="text" class="datainp startDate" readonly/></div>
			<div class="u-end"><label data-localize="statistics_print2.endtime">结束时间</label><input type="text" class="datainp endDate" readonly/></div>
		</div>

		<div class="u-changetime hour-changetime">
			<div class="u-start"><label data-localize="statistics_print2.begintime">开始时间</label><input type="text" class="datainp startDate1" readonly/></div>
			<div class="u-end"><label data-localize="statistics_print2.endtime">结束时间</label><input type="text" class="datainp endDate1" readonly/></div>
		</div>

		<div class="u-changetime sec-changetime" hidden>
			<div class="u-start"><label data-localize="statistics_print2.begintime">开始时间</label><input type="text" class="datainp startDate2" readonly/></div>
			<div class="u-end"><label data-localize="statistics_print2.endtime">结束时间</label><input type="text" class="datainp endDate2" readonly/></div>
		</div>

		<div class="u-xm">
			<label style="margin-left: 90px;" data-localize="statistics_print2.line">产线</label>
			<select class="u-selectLine">
			</select>
			<label style="margin-left: 5px;" data-localize="statistics_print2.item">项目</label>
			<select class="u-type1">
				<option value ="1" data-localize="statistics_print2.gratinglinewidth">线宽</option>
				<option value ="2" data-localize="statistics_print2.wetweight">湿重</option>
				<option value ="3" data-localize="statistics_print2.eta">效率</option>
			</select>
			<br><br>
			<label style="margin-left: 90px;" data-localize="statistics_print2.printchoose">印刷机选择</label>
			<select class="u-selectSheb">
			</select>
			<a class="u-downloadCSV" id="downloadCSV" style="margin-left: 10px;"><div class="u-btnblue" data-localize="statistics_print2.downloadCSV">导出CSV</div></a>
			<div class="u-btnblue u-confirmbtn" data-localize="statistics_print2.confirm">确认</div>
		</div>
		<div id='canvasDiv'></div>
	</div>
</div>

<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/jquery.localize.min.js" charset="utf-8"></script>
<script type="text/javascript" src="js/language_cookie.js" charset="utf-8"></script>
<script type="text/javascript" src="js/ichart.1.2.1.min.js"></script>
<script type="text/javascript" src="js/jedate/jquery.jedate.min.js"></script>
<script type="text/javascript">
	var csvData;
var chart;
var labela = [];
var data;
$(function() {
    $(".loading").hide();
    csvData = {
        header: ['产线ID','设备ID','设备名','硅片id','项目','项目值','时间'],
        body: []
    };
        data = [{
            name: '台面A',
            value: [null],
            color: '#29abe2',
            line_width: 2,
            texta:"平均值A："
        }, {
            name: '台面B',
            value: [null],
            color: '#0ca01f',
            line_width: 2,
            textb:"平均值B："
        }, {
            name: '台面C',
            value: [null],
            color: '#e8d223',
            line_width: 2,
            textc:"平均值C："
        }, {
            name: '台面D',
            value: [null],
            color: '#e84923',
            line_width: 2,
            textd:"平均值D："
        }];
	labela[0] = $('.startDate').val();
    labela[1] = $('.endDate').val();
    
	var lineurl = getUrl('statistics_getLine');
    $.ajax({  
        type:'get',      
        url: lineurl,
        async : false, 
        dataType: "json", 
        success:function(data){
        	var inhtml = "";
            if (data.resultCode == 200 && data.resultMessage == "OK") {
            	for (var i = 0,len = data.resultObject.length; i < len; i++) {
            		inhtml += '<option value="'+data.resultObject[i].lineId.trim()+'">'+data.resultObject[i].lineName+'</option>';
				}
				$('.u-selectLine').append(inhtml);

				var linen = data.resultObject[0].trim()?data.resultObject[0].lineId.trim():"A";
		    	$('.u-selectSheb').html("");
		    	var html2 = '<option value="2">'+linen+'2</option><option value="5">'+linen+'5</option><option value="8">'+linen+'8</option><option value="11">'+linen+'11</option>';
		    	$('.u-selectSheb').append(html2);
            }
        },
        error:function(){
            console.log("selectEqByLineId fail");
        }  
    });

    chart = new iChart.LineBasic2D({
		render: 'canvasDiv',
		animation:false,
		animation_duration:'500',
		data: data,
		align: 'center',
		width: 900,
		height: 460,
		shadow: false,
		legend:{
			enable:true,
			background_color : null,
			border : {
				enable : false
			}
		},
		background_color: '#ffffff',
		tip: {
			enable: false,
			shadow: true,
			listeners: {
				//tip:提示框对象、name:数据名称、value:数据值、text:当前文本、i:数据点的索引
				parseText: function(tip, name, value, text, i) {
					return "<span style='color:#005268;font-size:12px;'>" + labels[i] +":00访问量约:<br/>" +
						"</span><span style='color:#005268;font-size:20px;'>" + value + "万</span>";
				}
			}
		},
		sub_option: {
			smooth: false,
			label: false,
			hollow: false,
			hollow_inside: false,
			point_size: 6
		},
		coordinate: {
			width: 640,
			height: 260,
			striped_factor: 0.18,
			gridlinesVisible:false,
			grid_color: '#4e4e4e',
			axis: {
				color: '#252525',
				width: [0, 0, 2, 2]
			},
			scale: [{
				position: 'left',
				start_scale: 0,
				end_scale: 10,
				scale_space: 10,
				scale_size: 2,
				scale_enable: false,
				label: {
					color: '#333333',
					font: '微软雅黑',
					fontsize: 11,
					fontweight: 600
				},
				scale_color: '#9f9f9f'
			}]
		}
	});
	//利用自定义组件构造左侧说明文本
	chart.plugin(new iChart.Custom({
		drawFn: function() {
			//计算位置
			var coo = chart.getCoordinate(),
				x = coo.get('originx'),
				y = coo.get('originy'),
				w = coo.width,
				h = coo.height;
			//在左上侧的位置，渲染一个单位的文字
			chart.target.textAlign('start')
				.textBaseline('bottom')
				.textFont('600 11px 微软雅黑')
				.fillText('', x - 40, y - 12, false, '#333333')
				.textBaseline('top')
				.fillText('时间', x + w + 70, y + h + 10, false, '#333333')
				.textBaseline('top')
				.textFont('600 14px 微软雅黑')
				.fillText(data[0].texta, x + w + 12, y,false,'#3e576f')
				.textBaseline('top')
				.textFont('600 14px 微软雅黑')
				.fillText(data[1].textb, x + w + 12, y+20,false,'#3e576f')
				.textBaseline('top')
				.textFont('600 14px 微软雅黑')
				.fillText(data[2].textc, x + w + 12, y+40,false,'#3e576f')
				.textBaseline('top')
				.textFont('600 14px 微软雅黑')
				.fillText(data[3].textd, x + w + 12, y+60,false,'#3e576f');
			chart.target.line(x,y+50,x+w,y+50,1,'#252525')
				.textAlign('start')
				.textBaseline('middle')
				.textFont('600 12px Verdana')
				.fillText('上限',x+5,y+50-10,false,'#252525');
			chart.target.line(x,y+160,x+w,y+160,1,'#252525')
				.textAlign('start')
				.textBaseline('middle')
				.textFont('600 12px Verdana')
				.fillText('下限',x+5,y+160+11,false,'#252525');
			chart.target.textAlign('start')
				.textBaseline('bottom')
				.textFont('600 11px 微软雅黑')
				.fillText('', x - 40, y - 12, false, '#333333')
				.textBaseline('top')
				.fillText(labela[0], 74, y + h + 8, false, '#333333')
				.textBaseline('top')
				.fillText(labela[1], w+74 , y + h + 8, false, '#333333');
		}
	}));
	chart.draw();

	var timeFlag = true;

	$(".startDate").click(function(){
		timeFlag = true;
	});

	$(".endDate").click(function(){
		timeFlag = true;
	});

	$(".startDate1").click(function(){
		timeFlag = true;
	});
	$(".endDate1").click(function(){
		timeFlag = true;
	});
	$(".startDate2").click(function(){
		timeFlag = true;
	});
	$(".endDate2").click(function(){
		timeFlag = true;
	});

	$(".startDate").jeDate({//按片，开始时间
//        dateCell:".startDate",
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, //isClear:false,
		minDate:"2014-09-19 00:00:00",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate").val("");
			}

			if($(".u-type1").val() != '2' && $(".endDate").val() && timeFlag) { //按小时，时间范围不能超过31天
				var endDate = $(".endDate").val();
				var startDate = $(".startDate").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 1*60*60) {
					$(".endDate").val("");
					alert("按片，时间范围不得超过1小时");
					timeFlag = false;
//						return false;
				}
			}

			if(!$(".endDate").val()) {
				$(".endDate").val($(".startDate").val());
			}
		}
	});
	$(".endDate").jeDate({//按片，结束时间
//        dateCell:".endDate",
        format:"YYYY-MM-DD hh:mm:ss",
        isinitVal:false,
        isTime:true, //isClear:false,
        minDate:"2014-09-19 00:00:00",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate").val("");
			}
			if($(".u-type1").val() != '2' && $(".startDate").val() && timeFlag) { //按小时，时间范围不能超过31天
				var endDate = $(".endDate").val();
				var startDate = $(".startDate").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 1*60*60) {
					$(".endDate").val("");
					alert("按片，时间范围不得超过1小时");
					timeFlag = false;
//						return false;
				}
			}
		}
    });
	$(".startDate1").jeDate({//按小时，开始时间
		format:"YYYY-MM-DD",
		isinitVal:false,
		isTime:true, //isClear:false,
		minDate:"2014-09-19",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate1").val("");
			}
			if($(".u-type1").val() != '2' && $(".endDate1").val()  && timeFlag) { //按小时，时间范围不能超过31天
				var endDate = $(".endDate1").val();
				var startDate = $(".startDate1").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 31*24*60*60) {
					$(".endDate1").val("");
					alert("按小时，时间范围不得超过31天");
					timeFlag = false;
//						return false;
				}
			}
			if(!$(".endDate1").val()) {
				$(".endDate1").val($(".startDate1").val());
			}
		}
	});
	$(".endDate1").jeDate({//按小时，结束时间
		format:"YYYY-MM-DD",
		isinitVal:false,
		isTime:true, //isClear:false,
		minDate:"2014-09-19",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate1").val("");
			}
			if($(".u-type1").val() != '2' && $(".startDate1").val() && timeFlag) { //按小时，时间范围不能超过31天
				var endDate = $(".endDate1").val();
				var startDate = $(".startDate1").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 31*24*60*60) {
					$(".endDate1").val("");
					alert("按小时，时间范围不得超过31天");
					timeFlag = false;
//						return false;
				}
			}
		}
	});
	$(".startDate2").jeDate({//按分，不得超过24小时
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, //isClear:false,
		minDate:"2014-09-19 00:00:00",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate2").val("");
			}
			if($(".u-type1").val() != '2' && $(".endDate2").val() && timeFlag) { //按分，不得超过24小时
				var endDate = $(".endDate2").val();
				var startDate = $(".startDate2").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 24*60*60) {
					alert("按分，时间范围不得超过24小时");
					$(".endDate2").val("");
					timeFlag = false;
//						return false;
				}
			}
			if(!$(".endDate2").val()) {
				$(".endDate2").val($(".startDate2").val());
			}
		}
	});
	$(".endDate2").jeDate({//按分，不得超过24小时
		format:"YYYY-MM-DD hh:mm:ss",
		isinitVal:false,
		isTime:true, //isClear:false,
		minDate:"2014-09-19 00:00:00",
		okfun:function(val) {
			if(!timeFlag){
				$(".endDate2").val("");
			}
			if($(".u-type1").val() != '2' && $(".startDate2").val() && timeFlag) { //按分，不得超过24小时
				var endDate = $(".endDate2").val();
				var startDate = $(".startDate2").val();
				var diff = timeminus(endDate,startDate);
				if(diff > 24*60*60) {
					alert("按分，时间范围不得超过24小时");
					$(".endDate2").val("");
					timeFlag = false;
//						return false;
				}
			}
		}
	});
	$('.u-selectLine').on('change',function(e){
    	var linen = $(this).find("option:selected").text();
    	$('.u-selectSheb').html("");
        var html2 = '<option value="2">'+linen+'2</option><option value="5">'+linen+'5</option><option value="8">'+linen+'8</option><option value="11">'+linen+'11</option>';
        $('.u-selectSheb').append(html2);
    })

    $('.u-downloadCSV').click(function(){
    	var obj = document.getElementById('downloadCSV');
        csvDownload('印刷机分析二',obj,csvData);
    });
	//开始画图
	$('.u-confirmbtn').click(function(){
		csvData['body'] = [];

		var url = getUrl('statistics_print2'),
			line,startDate,endDate,type,printType;
		line = $(".u-selectLine").val();
		var selectType = $(".selectType").val();
		if (!line) {
			return false;
		}
		startDate = "";
		endDate = "";

		if(selectType == "1") {//按片
			startDate = $('.startDate').val();
			endDate = $('.endDate').val();
		}
		if(selectType == "2") {//按小时
			startDate = $('.startDate1').val();
			endDate = $('.endDate1').val();
		}
		if(selectType == "3") {//按秒
			startDate = $('.startDate2').val();
			endDate = $('.endDate2').val();
		}

		type = $('.u-type1').val();
        printType = $('.u-selectSheb').val();
		console.log(line,startDate,endDate,type);
		labela[0] = startDate;
        labela[1] = endDate;
		var mes = getData(line,startDate,endDate,type,url,printType,selectType);


	})
});

function sel_type() { //选择查询方式(按片，按小时，按秒)后出发时间
	var typeVar = $(".selectType").val();
	if(typeVar == "1") {//按片
		$(".part-changetime").show();
		$(".hour-changetime").hide();
		$(".sec-changetime").hide();
	}

	if(typeVar == "2") {//按小时
		$(".part-changetime").hide();
		$(".hour-changetime").show();
		$(".sec-changetime").hide();
	}

	if(typeVar == "3") {//按秒
		$(".part-changetime").hide();
		$(".hour-changetime").hide();
		$(".sec-changetime").show();
	}
}

function getData(line,startDate,endDate,type,url,printType,selectType){
    $(".loading").show();
    var res = null;
    $.ajax({  
        type:'get',      
        url: url,
//        async : false,
        dataType: "json",
        data:{"line":line,"startDate":startDate,"endDate":endDate,"type":type,"printType":printType,"selectType":selectType},
        success:function(mes){
            $(".loading").hide();
            if (mes.resultCode == 200 && mes.resultMessage == "OK") {
                res = mes;
                var aaa = [0],
                    bbb = [0],
                    ccc = [0],
                    ddd = [0];
                console.log(mes);
                for (var i = 0,len = mes.resultObject.aList?mes.resultObject.aList.length:0; i < len; i++) {
                    aaa[i] = mes.resultObject.aList[i].yValue;
                    csvData['body'].push([line,"2","台面A",mes.resultObject.aList[i].WAFER_ID,$('.u-type1 option:selected').text(),mes.resultObject.aList[i].yValue,mes.resultObject.aList[i].xValue]);
                }
                for (var i = 0,len = mes.resultObject.bList?mes.resultObject.bList.length:0; i < len; i++) {
                    bbb[i] = mes.resultObject.bList[i].yValue;
                    csvData['body'].push([line,"5","台面B",mes.resultObject.bList[i].WAFER_ID,$('.u-type1 option:selected').text(),mes.resultObject.bList[i].yValue,mes.resultObject.bList[i].xValue]);
                }
                for (var i = 0,len = mes.resultObject.cList?mes.resultObject.cList.length:0; i < len; i++) {
                    ccc[i] = mes.resultObject.cList[i].yValue;
                    csvData['body'].push([line,"8","台面C",mes.resultObject.cList[i].WAFER_ID,$('.u-type1 option:selected').text(),mes.resultObject.cList[i].yValue,mes.resultObject.cList[i].xValue]);
                }
                for (var i = 0,len = mes.resultObject.dList?mes.resultObject.dList.length:0; i < len; i++) {
                    ddd[i] = mes.resultObject.dList[i].yValue;
                    csvData['body'].push([line,"11","台面D",mes.resultObject.dList[i].WAFER_ID,$('.u-type1 option:selected').text(),mes.resultObject.dList[i].yValue,mes.resultObject.dList[i].xValue]);
                }
                var aAvg2 = parseFloat(mes.resultObject.aAvg).toFixed(2),
                    bAvg2 = parseFloat(mes.resultObject.bAvg).toFixed(2),
                    cAvg2 = parseFloat(mes.resultObject.cAvg).toFixed(2),
                    dAvg2 = parseFloat(mes.resultObject.dAvg).toFixed(2);
                var difff1 = timeminus(endDate,startDate),
                    difff2 = mes.resultObject.aList[0]?timeminus(mes.resultObject.aList[mes.resultObject.aList.length-1].xValue,mes.resultObject.aList[0].xValue):0,
                    difff3 = mes.resultObject.aList[0]?timeminus(mes.resultObject.aList[0].xValue,startDate):0;
                var per1 = (parseInt(difff3)/parseInt(difff1));
                var per3 = (parseInt(difff2)/parseInt(difff1));
                var xnum = mes.resultObject.aList.length/per3;
                var leftnum = parseInt(xnum*per1);
                var rightnum = Math.round(xnum) - leftnum -mes.resultObject.aList.length;
                console.log(leftnum,rightnum,xnum);
                for (var i = 0; i < leftnum; i++) {
                    aaa.unshift(null);
                    bbb.unshift(null);
                    ccc.unshift(null);
                    ddd.unshift(null);
                }
                for (var i = 0; i < rightnum; i++) {
                    aaa.push(null);
                    bbb.push(null);
                    ccc.push(null);
                    ddd.push(null);
                }
                data = [{
                    name: '台面A',
                    value: aaa,
                    color: '#29abe2',
                    line_width: 2,
                    texta:"平均值A："+aAvg2
                }, {
                    name: '台面B',
                    value: bbb,
                    color: '#29e24a',
                    line_width: 2,
                    textb:"平均值B："+bAvg2
                }, {
                    name: '台面C',
                    value: ccc,
                    color: '#e8d223',
                    line_width: 2,
                    textc:"平均值C："+cAvg2
                }, {
                    name: '台面D',
                    value: ddd,
                    color: '#e84923',
                    line_width: 2,
                    textd:"平均值D："+dAvg2
                }];
                chart.load(data);
            }
        },
        error:function(){
            $(".loading").hide();
            console.log("fail");
        }  
    });
    return res;
}
</script>

</body>
</html>